using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace FrameWork
{
    [RequireComponent(typeof(BaseDialog))]
    public class UILogic : MonoBehaviour
    {
        private BaseDialog _dialog;

        public BaseDialog Dialog
        {
            get => _dialog;
        }

        private void Awake()
        {
            //这块需要OnCreate
            _dialog = GetComponent<BaseDialog>();
        }

        public void OnInit()
        {
            var view = GetComponent<BaseView>();
            (_dialog as IUIBridge).SetView(view);
            _dialog.OnInit();
        }

        public void OnShow()
        {
            _dialog.OnShow();
        }

        public void OnUpdate(float deltaTime)
        {
            _dialog.OnUpdate(deltaTime);
        }

        public void OnCoverd()
        {
            _dialog.OnCoverd();
        }

        public void OnUnCoverd()
        {
            _dialog.OnUnCoverd();
        }

        public void OnRelease()
        {
            _dialog.OnRelease();
        }

        public void SetVisible(bool visible)
        {
            gameObject.SetActive(visible);
        }
    }
}

